3.16.32 \(\int \frac {(c+d x)^2}{(a-b x) (a+b x)} \, dx\) [1532]

Optimal. Leaf size=62 \[ -\frac {d^2 x}{b^2}-\frac {(b c+a d)^2 \log (a-b x)}{2 a b^3}+\frac {(b c-a d)^2 \log (a+b x)}{2 a b^3} \]

[Out]

-d^2*x/b^2-1/2*(a*d+b*c)^2*ln(-b*x+a)/a/b^3+1/2*(-a*d+b*c)^2*ln(b*x+a)/a/b^3

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.043, Rules used = {84} \begin {gather*} -\frac {(a d+b c)^2 \log (a-b x)}{2 a b^3}+\frac {(b c-a d)^2 \log (a+b x)}{2 a b^3}-\frac {d^2 x}{b^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*x)^2/((a - b*x)*(a + b*x)),x]

[Out]

-((d^2*x)/b^2) - ((b*c + a*d)^2*Log[a - b*x])/(2*a*b^3) + ((b*c - a*d)^2*Log[a + b*x])/(2*a*b^3)

Rule 84

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {(c+d x)^2}{(a-b x) (a+b x)} \, dx &=\int \left (-\frac {d^2}{b^2}+\frac {(b c+a d)^2}{2 a b^2 (a-b x)}+\frac {(-b c+a d)^2}{2 a b^2 (a+b x)}\right ) \, dx\\ &=-\frac {d^2 x}{b^2}-\frac {(b c+a d)^2 \log (a-b x)}{2 a b^3}+\frac {(b c-a d)^2 \log (a+b x)}{2 a b^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 54, normalized size = 0.87 \begin {gather*} \frac {-2 a b d^2 x-(b c+a d)^2 \log (a-b x)+(b c-a d)^2 \log (a+b x)}{2 a b^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)^2/((a - b*x)*(a + b*x)),x]

[Out]

(-2*a*b*d^2*x - (b*c + a*d)^2*Log[a - b*x] + (b*c - a*d)^2*Log[a + b*x])/(2*a*b^3)

________________________________________________________________________________________

Maple [A]
time = 0.12, size = 84, normalized size = 1.35

method result size
norman \(-\frac {d^{2} x}{b^{2}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (b x +a \right )}{2 b^{3} a}-\frac {\left (a^{2} d^{2}+2 a b c d +b^{2} c^{2}\right ) \ln \left (-b x +a \right )}{2 b^{3} a}\) \(82\)
default \(-\frac {d^{2} x}{b^{2}}+\frac {\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \ln \left (b x +a \right )}{2 b^{3} a}+\frac {\left (-a^{2} d^{2}-2 a b c d -b^{2} c^{2}\right ) \ln \left (-b x +a \right )}{2 a \,b^{3}}\) \(84\)
risch \(-\frac {d^{2} x}{b^{2}}+\frac {a \ln \left (-b x -a \right ) d^{2}}{2 b^{3}}-\frac {\ln \left (-b x -a \right ) c d}{b^{2}}+\frac {\ln \left (-b x -a \right ) c^{2}}{2 b a}-\frac {a \ln \left (b x -a \right ) d^{2}}{2 b^{3}}-\frac {\ln \left (b x -a \right ) c d}{b^{2}}-\frac {\ln \left (b x -a \right ) c^{2}}{2 b a}\) \(116\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2/(-b*x+a)/(b*x+a),x,method=_RETURNVERBOSE)

[Out]

-d^2*x/b^2+1/2/b^3*(a^2*d^2-2*a*b*c*d+b^2*c^2)/a*ln(b*x+a)+1/2*(-a^2*d^2-2*a*b*c*d-b^2*c^2)/a/b^3*ln(-b*x+a)

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 82, normalized size = 1.32 \begin {gather*} -\frac {d^{2} x}{b^{2}} + \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x + a\right )}{2 \, a b^{3}} - \frac {{\left (b^{2} c^{2} + 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x - a\right )}{2 \, a b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(-b*x+a)/(b*x+a),x, algorithm="maxima")

[Out]

-d^2*x/b^2 + 1/2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(b*x + a)/(a*b^3) - 1/2*(b^2*c^2 + 2*a*b*c*d + a^2*d^2)*lo
g(b*x - a)/(a*b^3)

________________________________________________________________________________________

Fricas [A]
time = 1.48, size = 76, normalized size = 1.23 \begin {gather*} -\frac {2 \, a b d^{2} x - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x + a\right ) + {\left (b^{2} c^{2} + 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b x - a\right )}{2 \, a b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(-b*x+a)/(b*x+a),x, algorithm="fricas")

[Out]

-1/2*(2*a*b*d^2*x - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(b*x + a) + (b^2*c^2 + 2*a*b*c*d + a^2*d^2)*log(b*x - a
))/(a*b^3)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 112 vs. \(2 (51) = 102\).
time = 0.34, size = 112, normalized size = 1.81 \begin {gather*} - \frac {d^{2} x}{b^{2}} + \frac {\left (a d - b c\right )^{2} \log {\left (x + \frac {2 a^{2} c d + \frac {a \left (a d - b c\right )^{2}}{b}}{a^{2} d^{2} + b^{2} c^{2}} \right )}}{2 a b^{3}} - \frac {\left (a d + b c\right )^{2} \log {\left (x + \frac {2 a^{2} c d - \frac {a \left (a d + b c\right )^{2}}{b}}{a^{2} d^{2} + b^{2} c^{2}} \right )}}{2 a b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2/(-b*x+a)/(b*x+a),x)

[Out]

-d**2*x/b**2 + (a*d - b*c)**2*log(x + (2*a**2*c*d + a*(a*d - b*c)**2/b)/(a**2*d**2 + b**2*c**2))/(2*a*b**3) -
(a*d + b*c)**2*log(x + (2*a**2*c*d - a*(a*d + b*c)**2/b)/(a**2*d**2 + b**2*c**2))/(2*a*b**3)

________________________________________________________________________________________

Giac [A]
time = 1.70, size = 84, normalized size = 1.35 \begin {gather*} -\frac {d^{2} x}{b^{2}} + \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | b x + a \right |}\right )}{2 \, a b^{3}} - \frac {{\left (b^{2} c^{2} + 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | b x - a \right |}\right )}{2 \, a b^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(-b*x+a)/(b*x+a),x, algorithm="giac")

[Out]

-d^2*x/b^2 + 1/2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(abs(b*x + a))/(a*b^3) - 1/2*(b^2*c^2 + 2*a*b*c*d + a^2*d^
2)*log(abs(b*x - a))/(a*b^3)

________________________________________________________________________________________

Mupad [B]
time = 1.18, size = 81, normalized size = 1.31 \begin {gather*} \frac {\ln \left (a+b\,x\right )\,\left (a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2\right )}{2\,a\,b^3}-\frac {d^2\,x}{b^2}-\frac {\ln \left (a-b\,x\right )\,\left (a^2\,d^2+2\,a\,b\,c\,d+b^2\,c^2\right )}{2\,a\,b^3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*x)^2/((a + b*x)*(a - b*x)),x)

[Out]

(log(a + b*x)*(a^2*d^2 + b^2*c^2 - 2*a*b*c*d))/(2*a*b^3) - (d^2*x)/b^2 - (log(a - b*x)*(a^2*d^2 + b^2*c^2 + 2*
a*b*c*d))/(2*a*b^3)

________________________________________________________________________________________